<template>
  <div id="app">
    <component :is="page"></component>
  </div>
</template>
<script>
import LoginPage from "./components/Login";
import HomePage from "./components/Home";

export default {
  name: 'App',
  components: {
    LoginPage,
    HomePage
  },
  data() {
    return {
      page: 'LoginPage',
      token: null,
    }
  },
  watch: {
    token(val) {
      if (val) {
        this.page = 'HomePage'
      } else {
        this.page = 'LoginPage'
      }
    }
  },
  mounted() {
    this.token = localStorage.getItem('token')
  }
}
</script>
<style>
* {
  padding: 0;
  margin: 0;
}
</style>
